home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / tbasmhlp.arc / SOURCE.ARC / SCRREST.ASM < prev    next >
Assembly Source File  |  1987-07-24  |  1KB  |  52 lines

  1. ;FILE    :SCRREST (Restores screen from an integer array)
  2. ;USEAGE    :SCRREST (ARRAY%(),AREA%) Restore screen to arrary%(0)+2000*AREA%
  3. scrrest    segment
  4.     assume    cs:scrrest
  5.     push    bp        ;save bp
  6.     mov    bp,sp
  7.     push    ds        ;save this too!
  8.  
  9.     les    di,[bp+6]    ;Calculate offset into array.
  10.     mov    ax,es:[di]    ;Let's see where to go in array.
  11.     mov    bx,4000
  12.     mul    bx        ;4000 bytes per page.
  13.     mov    si,ax        ;This is offset into array. (Source)
  14.      mov    di,0        ;Start at begining of screen area. (Destination)
  15. ;Let's figure out display address/color or monochrome?
  16.     mov    bx,0040h    ;seg that has vid info.
  17.     mov    es,bx
  18.     mov    dx,es:[063h]    ;base address of video port
  19.     add    dx,6        ;we want base+6
  20.     mov    ax,0b000h    ;monochrome address
  21.     mov    bx,es:[010h]    ;display mode set
  22.     and    bx,110000b    ;mask off what we want
  23.     cmp    bx,110000b    ;are we color?
  24.     jz    mono        ;jump if monochrome is set.
  25.     mov    ah,0b8h        ;base address of color
  26. mono:    mov    es,ax        ;No let's set source segment.
  27.     mov    ax,[bp+10]    ;Set DS to start of array. (Source)
  28.     push    ax
  29.     pop    ds
  30.     mov    cx,2000        ;Move 2000 words.
  31.     cld            ;Clear direction flag for string move.
  32. loopm:    cli            ;NO IRQS while I'm working!
  33. notyet:    in    al,dx        ;read video board
  34.     shr    al,1        ;bit we want is 0
  35.     jb    notyet
  36.     sti            ;Let'm get outa the car and go potty
  37.     nop            ;pass some time folks
  38.     cli
  39. notyet2:in    al,dx
  40.     shr    al,1
  41.     jnb    notyet2
  42.     movsw
  43.     sti            ;OK IRQS again
  44.     loop    loopm
  45.  
  46.     pop    ds
  47.     pop    bp
  48.  
  49.  
  50. scrrest    ends
  51.     end
  52.